import service from "@/utils/request";

/**
 * 新增信息
 * @param {*} data 
 * @returns 
 */
export function addInfo(data) {
    console.log("新增信息请求数据：", data);
    let response = service.request({
        method: "post",
        url: "/news/addInfo",
        data
    });
    response.then(response=>console.log("新增信息响应数据：", response));
    return response;
}

/**
 * 修改信息
 * @param {*} data 
 * @returns 
 */
export function editInfo(data) {
    console.log("修改信息请求数据：", data);
    let response = service.request({
        method: "post",
        url: "/news/editInfo",
        data
    });
    response.then(response=>console.log("修改信息响应数据：", response));
    return response;
}

/**
 * 获取信息
 * @param {*} data 
 * @returns 
 */
export function queryInfoList(data) {
    console.log("获取信息请求数据：", data);
    let response = service.request({
        method: "get",
        url: "/news/queryInfoList",
        data
    });
    response.then(response=>console.log("获取信息响应数据：", response));
    return response;
}

/**
 * 删除信息
 * @param {*} data 
 * @returns 
 */
export function deleteInfo(data) {
    console.log("删除信息请求数据：", data);
    let response = service.request({
        method: "post",
        url: "/news/deleteInfo",
        data
    });
    response.then(response=>console.log("删除信息响应数据：", response));
    return response;
}

/**
 * 添加一级分类
 * @param {*} data 
 * @returns 
 */
export function addFirstCategory(data) {
    console.log("添加一级分类请求数据：", data);
    let response = service.request({
        method: "post",
        url: "/news/addFirstCategory",
        data
    });
    response.then(response=>console.log("添加一级分类响应数据：", response));
    return response;
}

/**
 * 修改一级分类
 * @param {*} data 
 * @returns 
 */
export function editCategory(data) {
    console.log("修改一级分类请求数据：", data);
    let response = service.request({
        method: "post",
        url: "/news/editCategory",
        data
    });
    response.then(response=>console.log("修改一级分类响应数据：", response));
    return response;
}

/**
 * 添加子级分类
 * @param {*} data 
 * @returns 
 */
export function addChildrenCategory(data) {
    console.log("添加子级分类请求数据：", data);
    let response = service.request({
        method: "post",
        url: "/news/addChildrenCategory",
        data
    });
    response.then(response=>console.log("添加子级分类响应数据：", response));
    return response;
}

/**
 * 获取分类
 * @param {*} data 
 * @returns 
 */
export function queryCategoryList(data) {
    console.log("获取分类请求数据：", data);
    let response = service.request({
        method: "get",
        url: "/news/queryCategoryList",
        data
    });
    response.then(response=>console.log("获取分类响应数据：", response));
    return response;
}

/**
 * 删除分类
 * @param {*} data 
 * @returns 
 */
export function deleteCategory(data) {
    console.log("删除分类请求数据：", data);
    let response = service.request({
        method: "post",
        url: "/news/deleteCategory",
        data
    });
    response.then(response=>console.log("删除分类响应数据：", response));
    return response;
}